import request from '@/utils/request'

/**
 * 系统基础[Redis]
 */
export function useBaseRedisApi() {
  return {
    /**
     * 保存对象
     * @param data
     * @constructor
     */
    SetBaseRedisCache: async (data?: object) => {
      return request({
        url: '/api-base/Redis/set_cache',
        method: 'post',
        data
      })
    },

    /**
     * 获取对象
     * @param key
     * @constructor
     */
    GetBaseRedisCache: async (key?: string) => {
      return request({
        url: `/api-base/Redis/get_cache/${key}`,
        method: 'get'
      })
    },

    /**
     * 删除对象
     * @param key
     * @constructor
     */
    DeleteBaseRedisCache: async (key?: string) => {
      return request({
        url: `/api-base/Redis/clear_key/${key}`,
        method: 'delete'
      })
    }
  }
}
